﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace CControl
{
    public class Cls_TipoEvento
    {
        public int EVTid_tipo_evento { get; set; }
        public string EVTnombre { get; set; }        

        public static DataTable mtd_ListarTipoEvento()
        {
            try
            {

                //oConexion.ConnectionString = _ConnectionString;
                //oConexion.Open();
                Cls_Conexion Objconexion = new Cls_Conexion();
                SqlCommand Objcomando = new SqlCommand();
                SqlDataAdapter ObjDataAdapter = new SqlDataAdapter();
                DataTable ObjDataTable = new DataTable();

                Objcomando.CommandType = CommandType.StoredProcedure;
                Objcomando.CommandText = "USP_S_LISTAR_TIPOEVENTO";

                //Objcomando.Parameters.Add(new SqlParameter("@CODIGOCLIENTE", SqlDbType.VarChar));
                //Objcomando.Parameters.Add(new SqlParameter("@RUCCLIENTE", SqlDbType.VarChar));
                //Objcomando.Parameters.Add(new SqlParameter("@RAZONCLIENTE", SqlDbType.VarChar));
                //Objcomando.Parameters.Add(new SqlParameter("@DIRECCIONCLIENTE", SqlDbType.VarChar));
                //Objcomando.Parameters.Add(new SqlParameter("@TELEFONO1CLIENTE", SqlDbType.VarChar));
                //Objcomando.Parameters.Add(new SqlParameter("@LOCALIDADCLIENTE", SqlDbType.VarChar));
                //Objcomando.Parameters.Add(new SqlParameter("@DEPARTAMENTOCLIENTE", SqlDbType.VarChar));
                //Objcomando.Parameters.Add(new SqlParameter("@PROVINCIACLIENTE", SqlDbType.VarChar));
                //Objcomando.Parameters.Add(new SqlParameter("@PAISCLIENTE", SqlDbType.VarChar));
                //Objcomando.Parameters.Add(new SqlParameter("@CONTACTOCLIENTE", SqlDbType.VarChar));
                //Objcomando.Parameters.Add(new SqlParameter("@TELEFONO2CLIENTE", SqlDbType.VarChar));
                //Objcomando.Parameters.Add(new SqlParameter("@EMAILCLIENTE", SqlDbType.VarChar));
                //Objcomando.Parameters.Add(new SqlParameter("@CELULARCLIENTE", SqlDbType.VarChar));
                //Objcomando.Parameters["@CODIGOCLIENTE"].Value = CODCLIE;
                //Objcomando.Parameters["@RUCCLIENTE"].Value = RUCCLIE;
                //Objcomando.Parameters["@RAZONCLIENTE"].Value = RAZONCLIE;
                //Objcomando.Parameters["@DIRECCIONCLIENTE"].Value = DIRECLIE;
                //Objcomando.Parameters["@TELEFONO1CLIENTE"].Value = TELE1CLIE;
                //Objcomando.Parameters["@LOCALIDADCLIENTE"].Value = LOCACLIE;
                //Objcomando.Parameters["@DEPARTAMENTOCLIENTE"].Value = DEPCLIE;
                //Objcomando.Parameters["@PROVINCIACLIENTE"].Value = PROVCLIE;
                //Objcomando.Parameters["@PAISCLIENTE"].Value = PAISCLIE;
                //Objcomando.Parameters["@CONTACTOCLIENTE"].Value = CONTCLIE;
                //Objcomando.Parameters["@TELEFONO2CLIENTE"].Value = TELE2CLIE;
                //Objcomando.Parameters["@EMAILCLIENTE"].Value = EMAILCLIE;
                //Objcomando.Parameters["@CELULARCLIENTE"].Value = CELCLIE;

                Objcomando.Connection = Objconexion.Conectar();
                Objcomando.ExecuteNonQuery();

                ObjDataAdapter.SelectCommand = Objcomando;
                ObjDataAdapter.Fill(ObjDataTable);

                Objconexion = null;
                ObjDataAdapter = null;

                return ObjDataTable;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                Cls_Conexion desconectar = new Cls_Conexion();
                desconectar.Desconectar();
            }
        }
    }
}
